package com.snatch.deal.shop.common.util;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * Created by hao.g on 18/5/16.
 */
public class FileUtils {
    /**
     * 加载classpath下的lua脚本
     * @param inputStream
     * @return
     * @throws IOException
     */
    public static String loadScript(InputStream inputStream) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        StringBuffer buffer = new StringBuffer();
        String line = null;
        while ((line = bufferedReader.readLine()) != null){
            buffer.append(line).append(System.lineSeparator());
        }
        return buffer.toString();
    }
}
